﻿using System.Net;
using Provausio.Server.Nzb.Poller.Object.Client;

namespace Provausio.Server.Nzb.Poller.Data.Source
{
    public class CouchPotatoPingSource : PingApiOperationBase
    {
        protected override string ApiUri
        {
            get { return Config["CouchPotatoUri"]; }
        }

        protected override string ApiFormat
        {
            get { return string.Format("api/{0}/app.available", Config["CouchPotatoApiKey"]); }
        }

        public CouchPotatoPingSource()
            : base("Couch Potato")
        {
            // no query parameters
        }
        public override bool IsAlive()
        {
            var result = MakeCall<CouchPotatoPingResponse>();
            return result != null && result.StatusCode == HttpStatusCode.OK;
        }
    }
}
